/* license section

Flash MiniBuilder is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Flash MiniBuilder is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Flash MiniBuilder.  If not, see <http://www.gnu.org/licenses/>.


Author: Victor Dramba
2009
*/

package ro.minibuilder.main.editor
{
	import flash.display.Loader;
	import flash.events.Event;
	import flash.utils.ByteArray;
	
	import org.aswing.AssetPane;
	import org.aswing.JLabel;
	import org.aswing.JPanel;
	import org.aswing.JScrollPane;
	
	public class ImageEditor extends JPanel implements IEditor, IBinEditor
	{
		
		public function loadData(data:ByteArray):void
		{
			removeAll();
			var ld:Loader = new Loader;
			ld.loadBytes(data);
			ld.contentLoaderInfo.addEventListener(Event.COMPLETE, function(e:Event):void {
				append(new JScrollPane(new AssetPane(ld.content)));
			});
			dispatchEvent(new Event('status'));
		}
		
		private var path:String;
		
		public function get filePath():String
		{
			return path;
		}
		
		public function set filePath(path:String):void
		{
			this.path = path;
			//lbl.setText(path);
		}
		
		public function get status():String
		{
			return 'image loaded';
		}
		
		public function get percentReady():Number
		{
			return 1;
		}
		
		public function get changed():Boolean
		{
			return false;
		}
	}
}